{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class=""><a href="{:url('admin/goods/index')}">商品列表</a></li>
            <li class="layui-this">添加商品</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="{:url('admin/goods/save')}" method="post">
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="goods_name" value="" required lay-verify="required"
                                   placeholder="请输入商品名称(限制12字)" class="layui-input">
                        </div>
                    </div>




                    <div class="layui-form-item">
                        <label class="layui-form-label">起拍价格</label>
                        <div class="layui-input-block">
                            <input type="text" name="start_price" value="" required lay-verify="required"
                                   placeholder="请输入起拍价格" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">加价幅度</label>
                        <div class="layui-input-block">
                            <input type="text" name="raise_price" value="" required lay-verify="required"
                                   placeholder="请输入加价幅度" class="layui-input">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label">市场价</label>
                        <div class="layui-input-block">
                            <input type="text" name="market_price" value="" required lay-verify="required"
                                   placeholder="请输入市场价" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">本店价</label>
                        <div class="layui-input-block">
                            <input type="text" name="shop_price" value="" required lay-verify="required"
                                   placeholder="请输入本店价" class="layui-input">
                        </div>
                    </div>

                    <!--<div class="layui-form-item">-->
                        <!--<label class="layui-form-label">图片封面</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<input type="text" name="original_img" value="" lay-verify="required" class="layui-input layui-input-inline" id="img_url">-->
                            <!--<input type="file" name="image" lay-type="images" class="layui-upload-file">-->
                            <!--<div class="img-photo" style="width: 100px;height: 80px;margin:20px 0;display:none">-->
                                <!--<img src="" alt="" id="imgUrl" style="height:80px">-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->

                    <div class="layui-form-item">
                        <label class="layui-form-label">图片封面</label>
                        <div class="layui-input-block">
                            <input type="file" multiple name="" class="upimg">
                            <div class="img-url-box"></div>
                            <div class="img-box"></div>
                        </div>
                        <input type="hidden" name="original_img" value="" id="cover_arr"/>
                    </div>

                    <div class="layui-form-item">
                    <label class="layui-form-label">详细介绍</label>
                    <div class="layui-input-block">
                        <input type="text" name="detail_img" value="" lay-verify="required" class="layui-input layui-input-inline" id="img_url">
                        <input type="file" name="image" lay-type="images" class="layui-upload-file">
                        <div class="img-photo" style="width: 100px;height: 80px;margin:20px 0;display:none">
                        <img src="" alt="" id="imgUrl" style="height:80px">
                    </div>
                    </div>
                    </div>



                    <!--<div class="layui-form-item">-->
                        <!--<label class="layui-form-label">商品内容</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<textarea id="content_box" placeholder="" class="layui-textarea"-->
                                      <!--name="goods_content"></textarea>-->
                        <!--</div>-->
                    <!--</div>-->

                    <div class="layui-form-item">
                        <label class="layui-form-label">竞拍结束时间</label>
                        <div class="layui-input-inline">
                            <input class="layui-input date" placeholder="yyyy-MM-dd HH:mm:ss" name="end_time" value="{php} echo date('Y-m-d H:i:s',time());{/php}" type="text">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">显示设置</label>
                        <div class="layui-input-block">
                            <input type="radio" name="is_on_sale" value="0" title="下架" checked="checked">
                            <input type="radio" name="is_on_sale" value="1" title="上架">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="">保存</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script src="__JS__/ueditor/ueditor.config.js"></script>
<script src="__JS__/ueditor/ueditor.all.min.js"></script>
{/block}
{block name="script"}
<script>

    synchrobulid();
    $(function() {
        layui.upload({
            url: "/api/file_upload/upload",
            success: function (data) {
                if (data.error === 0 && data.type === 'image') {
                    document.getElementById('img_url').value = data.url;
                    $('.img-photo').show();
                    document.getElementById('imgUrl').src = data.url;
                } else {
                    layer.msg(data.message);
                }
            }
        });

        $('.date').on('click', function () {
            laydate({
                elem: this
                ,format: 'YYYY-MM-DD hh:mm:ss'
                ,type: 'datetime'
            })
        });
    });


</script>
{/block}